﻿@model Dyd.BaseService.ServiceCenter.Domain.Model.tb_system_config
@{
    ViewBag.Title = "修改系统配置";
    Layout = "~/Views/Shared/_LayoutPage.cshtml";
}

<div class="main_content">
    <div class="top">
        <h3 class="fl">@ViewBag.Title</h3>
        <a class="fr back" href="javascript:history.go(-1)">返回</a>
    </div>
    <div class="main mt10 pt10">
        <div class="fl edit2">
            @using (Html.BeginForm())
            {
                @Html.AntiForgeryToken()
                @Html.ValidationSummary(true)
                @Html.HiddenFor(model => model.id)
                <ul class="mydetail">
                    <li class="fm_item">
                        @Html.LabelFor(model => model.key)：
                        @Html.TextBoxFor(model => model.key, new { @maxlength = 200 })
                        @Html.ValidationMessageFor(model => model.key)
                    </li>
                    <li class="fm_item">
                        @Html.LabelFor(model => model.value)：
                        @Html.TextBoxFor(model => model.value, new { @maxlength = 500 })
                        @Html.ValidationMessageFor(model => model.value)
                    </li>
                    <li class="fm_item">
                        @Html.LabelFor(model => model.remark)：
                        @Html.TextAreaFor(model => model.remark, new { @rows = 10, @maxlength = 1000 })
                        @Html.ValidationMessageFor(model => model.remark)
                    </li>

                    <li class="fm_item" style="margin-top: 10px;">
                        <p class="box">
                            <input id="btnSave" type="button" class="btn" value="保存" />
                        </p>
                    </li>
                </ul>
            }
        </div>
    </div>
</div>
@section Scripts{
    <script src="~/Scripts/jquery.validate.min.js"></script>
    <script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
    <script>
        $(function () {
            $("#btnSave").click(function () {
                if ($("form").valid()) {
                    var data = $("form").serialize();
                    $.ajax({
                        url: "/SystemConfig/SystemConfigEdit",
                        data: addAntiForgeryToken(data),
                        type: "post",
                        success: function (data) {
                            if (data.Flag) {
                                alert(data.Message);
                                window.location.href = "/SystemConfig/SystemConfigIndex";
                            } else {
                                alert(data.Message);
                            }
                        }
                    });
                }
            });
        });
    </script>
}